package site.wlwsjsx.iot_backend.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;

import java.time.LocalDateTime;

/**
 * 设备事件实体类
 * 对应表：device_event
 * 用于存储物模型设备事件（如identifier1、identifier2等）
 */
@Data
@Getter
@Setter
public class DeviceEvent {
    private Long id;                    // 主键ID
    private String deviceId;            // 设备ID
    private String eventIdentifier;     // 事件标识符（如identifier1、identifier2等）
    private String eventType;           // 事件类型（如device_status_change等）
    private String eventData;           // 事件数据（JSON字符串格式）
    private Float temperature;          // 温度数据
    private Float humidity;             // 湿度数据
    private Integer powerStatus;        // 电源状态
    private Integer lightStatus;        // 灯光状态
    private Integer relayNum1Status;    // 继电器1状态
    private Integer relayNum2Status;    // 继电器2状态
    private Float lightIntensity;       // 光照强度
    private Float smokeScope;           // 烟雾传感器值
    private Float flameScope;           // 火焰传感器值
    private Float heatScope;            // 热敏传感器值
    private String userId;              // 用户ID
    private String productId;           // 产品ID
    private String messageType;         // 消息类型
    private String notifyType;          // 通知类型

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime eventTime;    // 事件时间

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;   // 创建时间

    private Boolean processed;          // 是否已处理

    public DeviceEvent() {
        this.processed = false;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getDeviceId() {
        return deviceId;
    }

    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }

    public String getEventIdentifier() {
        return eventIdentifier;
    }

    public void setEventIdentifier(String eventIdentifier) {
        this.eventIdentifier = eventIdentifier;
    }

    public String getEventType() {
        return eventType;
    }

    public void setEventType(String eventType) {
        this.eventType = eventType;
    }

    public String getEventData() {
        return eventData;
    }

    public void setEventData(String eventData) {
        this.eventData = eventData;
    }

    public Float getTemperature() {
        return temperature;
    }

    public void setTemperature(Float temperature) {
        this.temperature = temperature;
    }

    public Float getHumidity() {
        return humidity;
    }

    public void setHumidity(Float humidity) {
        this.humidity = humidity;
    }

    public Integer getPowerStatus() {
        return powerStatus;
    }

    public void setPowerStatus(Integer powerStatus) {
        this.powerStatus = powerStatus;
    }

    public Integer getLightStatus() {
        return lightStatus;
    }

    public void setLightStatus(Integer lightStatus) {
        this.lightStatus = lightStatus;
    }

    public Integer getRelayNum1Status() {
        return relayNum1Status;
    }

    public void setRelayNum1Status(Integer relayNum1Status) {
        this.relayNum1Status = relayNum1Status;
    }

    public Integer getRelayNum2Status() {
        return relayNum2Status;
    }

    public void setRelayNum2Status(Integer relayNum2Status) {
        this.relayNum2Status = relayNum2Status;
    }

    public Float getLightIntensity() {
        return lightIntensity;
    }

    public void setLightIntensity(Float lightIntensity) {
        this.lightIntensity = lightIntensity;
    }

    public Float getSmokeScope() {
        return smokeScope;
    }

    public void setSmokeScope(Float smokeScope) {
        this.smokeScope = smokeScope;
    }

    public Float getFlameScope() {
        return flameScope;
    }

    public void setFlameScope(Float flameScope) {
        this.flameScope = flameScope;
    }

    public Float getHeatScope() {
        return heatScope;
    }

    public void setHeatScope(Float heatScope) {
        this.heatScope = heatScope;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getProductId() {
        return productId;
    }

    public void setProductId(String productId) {
        this.productId = productId;
    }

    public String getMessageType() {
        return messageType;
    }

    public void setMessageType(String messageType) {
        this.messageType = messageType;
    }

    public String getNotifyType() {
        return notifyType;
    }

    public void setNotifyType(String notifyType) {
        this.notifyType = notifyType;
    }

    public LocalDateTime getEventTime() {
        return eventTime;
    }

    public void setEventTime(LocalDateTime eventTime) {
        this.eventTime = eventTime;
    }

    public LocalDateTime getCreateTime() {
        return createTime;
    }

    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    public Boolean getProcessed() {
        return processed;
    }

    public void setProcessed(Boolean processed) {
        this.processed = processed;
    }

    @Override
    public String toString() {
        return "DeviceEvent{" +
                "id=" + id +
                ", deviceId='" + deviceId + '\'' +
                ", eventIdentifier='" + eventIdentifier + '\'' +
                ", eventType='" + eventType + '\'' +
                ", eventData='" + eventData + '\'' +
                ", temperature=" + temperature +
                ", humidity=" + humidity +
                ", powerStatus=" + powerStatus +
                ", lightStatus=" + lightStatus +
                ", relayNum1Status=" + relayNum1Status +
                ", relayNum2Status=" + relayNum2Status +
                ", lightIntensity=" + lightIntensity +
                ", smokeScope=" + smokeScope +
                ", flameScope=" + flameScope +
                ", heatScope=" + heatScope +
                ", userId='" + userId + '\'' +
                ", productId='" + productId + '\'' +
                ", messageType='" + messageType + '\'' +
                ", notifyType='" + notifyType + '\'' +
                ", eventTime=" + eventTime +
                ", createTime=" + createTime +
                ", processed=" + processed +
                '}';
    }

    public void setIsDeleted(int i) {

    }
}
